using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class BsAlterSectMap : EntityTypeConfiguration<BsAlterSect>
    {
        public BsAlterSectMap()
        {
            // Primary Key
            this.HasKey(t => t.ACCT);

            // Properties
            this.Property(t => t.ACCT)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.TYPE1)
                .HasMaxLength(2);

            this.Property(t => t.CLASS1)
                .HasMaxLength(1);

            this.Property(t => t.TYPEGEN)
                .HasMaxLength(3);

            this.Property(t => t.DESC)
                .HasMaxLength(30);

            this.Property(t => t.TYPE2)
                .HasMaxLength(2);

            this.Property(t => t.CLASS2)
                .HasMaxLength(1);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("BsAlterSect");
            this.Property(t => t.ACCT).HasColumnName("ACCT");
            this.Property(t => t.TYPE1).HasColumnName("TYPE1");
            this.Property(t => t.CLASS1).HasColumnName("CLASS1");
            this.Property(t => t.TYPEGEN).HasColumnName("TYPEGEN");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.TYPE2).HasColumnName("TYPE2");
            this.Property(t => t.CLASS2).HasColumnName("CLASS2");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");

            // Relationships
            this.HasRequired(t => t.Acct1)
                .WithOptional(t => t.BsAlterSect);

        }
    }
}
